home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 114 / ezscreen / test.lst < prev    next >
File List  |  1987-10-10  |  7KB  |  371 lines

  1. '
  2. Gosub Init
  3. '
  4. Gosub Ez_screen_demo
  5. '
  6. Procedure Init
  7.  Dim Scr$(24)
  8. Return
  9. '
  10. Procedure Display_screen
  11.  cls
  12.  Gosub Normvideo
  13.  For Y=1 To 24
  14.  Print At(1,Y);scr$(y);
  15.  Next Y
  16. Return
  17. '
  18. Procedure Decipher_it
  19.  L=1
  20.  Repeat
  21.  Print At(X,Y);chr$(0);
  22.  Void Xbios(21,1)
  23.  Valid=False
  24.  Gosub Inversevideo
  25.  Repeat
  26.  T$=Inkey$
  27.  Until Asc(Right$(T$,1))<>0
  28.  '
  29.  If Type$=chr$(65) And ((Asc(T$)=>65 And Asc(T$)<=90) Or (Asc(T$)=>97 And Asc(T$)<=122) Or (Asc(T$)=>48 And Asc(T$)<=57)) Then
  30.  Valid=True
  31.  Endif
  32.  '
  33.  If Type$=chr$(78) And Asc(T$)=>48 And Asc(T$)<=57 Then
  34.  Valid=True
  35.  Endif
  36.  '
  37.  If Type$=chr$(67) And ((Asc(T$)=>65 And Asc(T$)<=90) Or (Asc(T$)=>97 And Asc(T$)<=122)) Then
  38.  Valid=True
  39.  Endif
  40.  '
  41.  If T$=chr$(32) Or T$=chr$(45) Or T$=chr$(46) Then
  42.  Valid=True
  43.  Endif
  44.  '
  45.  If Valid=True Then
  46.  Print At(X,Y);T$;
  47.  Add X,1
  48.  Zz$=chr$(0)
  49.  Mid$(User$,L,1)=Left$(T$,1)
  50.  Add L,1
  51.  Endif
  52.  '
  53.  If Valid=False Then
  54.  Zz$=Right$(T$,1)
  55.  '
  56.  If len(t$)=delimiter_length and  Asc(Zz$)=delimiter_value Then
  57.  Dun=True
  58.  Endif
  59.  '
  60.  ' LEFT ARROW, BACKSPACE OR DELETE
  61.  '
  62.  If Asc(Zz$)=75 Or Asc(Zz$)=127 Or Asc(Zz$)=8 Then
  63.  If X>X_start Then
  64.  Sub X,1
  65.  Sub L,1
  66.  Endif
  67.  Endif
  68.  '
  69.  ' RIGHT ARROW
  70.  '
  71.  If Asc(Zz$)=77 Then
  72.  If X<X_end Then
  73.  Add X,1
  74.  Add L,1
  75.  Endif
  76.  Endif
  77.  '
  78.  ' UP ARROW
  79.  '
  80.  If Asc(Zz$)=72 And In_line>1 Then
  81.  In_line=In_line-2
  82.  X=X_end+1
  83.  T$=chr$(0)
  84.  Endif
  85.  '
  86.  ' DOWN ARROW
  87.  '
  88.  If Asc(Zz$)=80 Then
  89.  X=X_end+1
  90.  T$=chr$(0)
  91.  Endif
  92.  Endif
  93.  '
  94.  If Asc(T$)<>0 Then
  95.  Print At(X,Y);chr$(0);
  96.  Endif
  97.  Until Asc(T$)=10 Or Asc(T$)=13 Or X>X_end Or Dun=True
  98.  If Dun=False Then
  99.  Add In_line,1
  100.  Endif
  101. Return
  102. '
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Procedure Inversevideo
  112. iv$=chr$(27)+chr$(112)
  113. Print iv$ ;
  114. Return
  115. '
  116. Procedure Normvideo
  117. Nv$=chr$(27)+chr$(113)
  118. print nv$ ;
  119. Return
  120. '
  121. Procedure You_are_done
  122. '
  123. ' anything you want to do as cleanup belongs here
  124. '
  125.  cls
  126.  Gosub Normvideo
  127. Return
  128. '
  129. ' <<<<<<<<<<<<<< only uniquely coded procedures after this point
  130. '
  131. Procedure Ez_screen_demo
  132. '
  133. ' declare variables
  134. '
  135. ' *****
  136.  Delimiter_value=71
  137.  Delimiter_length=2
  138. nmbr$=Space$(3)
  139. first_name$=Space$(10)
  140. last_name$=Space$(19)
  141. street$=Space$(29)
  142. city$=Space$(29)
  143. state$=Space$(2)
  144. zip$=Space$(5)
  145. zip_ext$=Space$(4)
  146. area_code$=Space$(3)
  147. phone_1$=Space$(3)
  148. phone_2$=Space$(4)
  149. '
  150. '
  151. ' If there is any existing data, call a user
  152. '
  153. ' supplied procedure to read it here
  154. '
  155. '
  156. ' Assign screen data
  157. '
  158. Gosub Screen_Assign_demo
  159. '
  160. ' display screen mask
  161. '
  162. Gosub Display_screen
  163. '
  164. ' display existing data if any
  165. '
  166. Gosub Display_user_data_demo
  167. '
  168. ' now go do the actual screen input
  169. '
  170. ' repeat calls to this procedure as necessary
  171. '
  172. Gosub Get_data_demo
  173. '
  174. ' the program is done at this point
  175. '
  176. Gosub You_are_done
  177. '
  178. '
  179. Return
  180. '
  181. Procedure Get_data_demo
  182.  In_line=1
  183.  Dun=False
  184. '
  185. ' LIMIT is the number of fields in the input screen
  186. '
  187. ' *****
  188. Limit=11
  189. '
  190. ' these calls set up the cursor to blink
  191. '
  192.  Void Xbios(21,2)
  193.  Void Xbios(21,4,10)
  194.  Repeat
  195. '
  196. ' each input field requires its own if...then construct here
  197. '
  198. '******
  199. If In_line=1 Then
  200. Type$="N"
  201. User$=nmbr$
  202. X_start=26
  203. X_end=28
  204. X=X_start
  205. Y=7
  206. Gosub Decipher_it
  207. nmbr$=User$
  208. Endif
  209. If In_line=2 Then
  210. Type$="C"
  211. User$=first_name$
  212. X_start=26
  213. X_end=35
  214. X=X_start
  215. Y=9
  216. Gosub Decipher_it
  217. first_name$=User$
  218. Endif
  219. If In_line=3 Then
  220. Type$="C"
  221. User$=last_name$
  222. X_start=26
  223. X_end=44
  224. X=X_start
  225. Y=11
  226. Gosub Decipher_it
  227. last_name$=User$
  228. Endif
  229. If In_line=4 Then
  230. Type$="A"
  231. User$=street$
  232. X_start=26
  233. X_end=54
  234. X=X_start
  235. Y=13
  236. Gosub Decipher_it
  237. street$=User$
  238. Endif
  239. If In_line=5 Then
  240. Type$="A"
  241. User$=city$
  242. X_start=26
  243. X_end=54
  244. X=X_start
  245. Y=15
  246. Gosub Decipher_it
  247. city$=User$
  248. Endif
  249. If In_line=6 Then
  250. Type$="A"
  251. User$=state$
  252. X_start=26
  253. X_end=27
  254. X=X_start
  255. Y=17
  256. Gosub Decipher_it
  257. state$=User$
  258. Endif
  259. If In_line=7 Then
  260. Type$="N"
  261. User$=zip$
  262. X_start=26
  263. X_end=30
  264. X=X_start
  265. Y=19
  266. Gosub Decipher_it
  267. zip$=User$
  268. Endif
  269. If In_line=8 Then
  270. Type$="N"
  271. User$=zip_ext$
  272. X_start=32
  273. X_end=35
  274. X=X_start
  275. Y=19
  276. Gosub Decipher_it
  277. zip_ext$=User$
  278. Endif
  279. If In_line=9 Then
  280. Type$="N"
  281. User$=area_code$
  282. X_start=26
  283. X_end=28
  284. X=X_start
  285. Y=21
  286. Gosub Decipher_it
  287. area_code$=User$
  288. Endif
  289. If In_line=10 Then
  290. Type$="N"
  291. User$=phone_1$
  292. X_start=30
  293. X_end=32
  294. X=X_start
  295. Y=21
  296. Gosub Decipher_it
  297. phone_1$=User$
  298. Endif
  299. If In_line=11 Then
  300. Type$="N"
  301. User$=phone_2$
  302. X_start=34
  303. X_end=37
  304. X=X_start
  305. Y=21
  306. Gosub Decipher_it
  307. phone_2$=User$
  308. Endif
  309.  If In_line>Limit Then
  310.  In_line=1
  311.  Endif
  312.  Until Dun=True
  313.  Void Xbios(21,0)
  314. Return
  315. '
  316. Procedure Display_user_data_demo
  317.  '
  318.  ' call this procedure to display any existing data
  319.  '
  320. Gosub Inversevideo
  321.  '
  322.  ' print any existing data with print at(x,y);???
  323.  '
  324.  ' *****
  325. Print At(26,7);nmbr$
  326. Print At(26,9);first_name$
  327. Print At(26,11);last_name$
  328. Print At(26,13);street$
  329. Print At(26,15);city$
  330. Print At(26,17);state$
  331. Print At(26,19);zip$
  332. Print At(32,19);zip_ext$
  333. Print At(26,21);area_code$
  334. Print At(30,21);phone_1$
  335. Print At(34,21);phone_2$
  336.  Gosub Normvideo
  337.  '
  338. Return
  339. '
  340. Procedure Screen_assign_demo
  341.  cls
  342.  '
  343.  '
  344. ' *****
  345. Scr$(1)="                                                                                "
  346. Scr$(2)="                                                                                "
  347. Scr$(3)="                     EZ_SCREEN registered user list                             "
  348. Scr$(4)="                                                                                "
  349. Scr$(5)="                                                                                "
  350. Scr$(6)="                                                                                "
  351. Scr$(7)="     registration number                                                        "
  352. Scr$(8)="                                                                                "
  353. Scr$(9)="              first name                                                        "
  354. Scr$(10)="                                                                                "
  355. Scr$(11)="              last name                                                         "
  356. Scr$(12)="                                                                                "
  357. Scr$(13)="              street                                                            "
  358. Scr$(14)="                                                                                "
  359. Scr$(15)="              city                                                              "
  360. Scr$(16)="                                                                                "
  361. Scr$(17)="              state                                                             "
  362. Scr$(18)="                                                                                "
  363. Scr$(19)="              zip             -                                                 "
  364. Scr$(20)="                                                                                "
  365. Scr$(21)="              phone         -   -                                               "
  366. Scr$(22)="                                                                                "
  367. Scr$(23)="                                                                                "
  368. Scr$(24)="                                                                                "
  369. Return
  370. '
  371.